# flask web 网络编程文件
from flask import Flask, render_template, request
from vsearch import search4letters

# html 调用方法：render_template  按照 jinja2 规则
#

app = Flask(__name__)


@app.route('/search4', methods=['POST'])
def do_search() -> 'html':
    phrase = request.form['phrase']
    letters = request.form['letters']
    address = request.form['address']
    地理坐标 = geocode(Mai_key,address)['geocodes'][0]['location']
    title = 'Here are your results:'
    results = str(search4letters(phrase, letters))
    return render_template('results.html',
                           the_title=title,
                           the_phrase=phrase,
                           the_letters=letters,
                           the_results=results,
                           the_address=地理坐标)


@app.route('/')
@app.route('/entry')
def entry_page() -> 'html':
    title = '欢迎来测试zhichao的元音字母是否存在小功能'
    return render_template('entry.html',
                           the_title=title)

@app.route('/entry')
def do_index():
    title = "API功能测试"
    return render_template('bootstrap.html',
                           the_title = title)

if __name__ == '__main__':
    app.run(debug=True)
